package com.itstack.springframework.test.processor;

import com.itstack.springframework.beans.BeansException;
import com.itstack.springframework.beans.ConfigurableListableBeanFactory;
import com.itstack.springframework.beans.PropertyValue;
import com.itstack.springframework.beans.factory.config.BeanDefinition;
import com.itstack.springframework.beans.factory.config.BeanFactoryPostProcessor;

/**
 * ClassName:
 * Description: TODO
 *
 * @author: Guo Shuai
 * @version: 1.0
 * @Date: 2021\11\25 0025
 */
public class UserServiceBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService");

        PropertyValue propertyValue = new PropertyValue("company", "字节跳动");

        beanDefinition.getPropertyValues().addPropertyValue(propertyValue);
    }
}
